import vue from 'vue'
import popupComponent from './popup.vue'
const Popupctor = vue.extend(popupComponent)
function showToast (text, time = 1500) {
  const toastDom = new Popupctor({
    el: document.createElement('div'),
    data () {
      return {
        text: text,
        showwrap: true
      }
    }
  })
  document.body.appendChild(toastDom.$el)
  setTimeout(() => { toastDom.showwrap = false }, time)
}
function popupToast () {
  vue.prototype.$popups = showToast
}

export default popupToast
